proc pr_t_add_placementBlkage_double_edge { inst } {
    set box1lists [dbget [dbget top.insts.cell.name ${inst} -p2].box]
    foreach box $box1lists {
	set re_box [dbShape -output rect $box SIZEX 0.456 SIZEY 0.48]
    	createPlaceBlockage -boxList ${re_box} -name pr_DOUBLE_EDGE_blkage -type hard
    	puts $re_box
    }
}

proc pr_t_del_placementBlkage_double_edge {} {
    deletePlaceBlockage pr_DOUBLE_EDGE_blkage
}

proc pr_t_add_via_RouteBlkage {} {
    set fpBox [lindex [dbget top.fplan.box] 0]
    createRouteBlk -box ${fpBox} -cutLayer "VIA3 VIA4 VIA5 VIA6 VIA7 VIA8 VIA9 VIA10 VIA11" -name PR_VIA_ROUTEBLKAGE
}

proc pr_t_del_via_RouteBlkage {} {
    deleteRouteBlk -name PR_VIA_ROUTEBLKAGE
}

proc pr_t_add_IP_PlaceBlkage {} {
    # DRC (FB.S.2.3 > 0.9)
    set X [expr 0.057*18]
    set Y [expr 0.24*4]
    set IPs [dbget selected]
    
    foreach ip ${IPs} {
        set box [dbget ${ip}.box]
        set blkage_box [dbShape ${box} SIZEX $X]
        set blkage_box [dbShape ${blkage_box} SIZEY $Y]

        createPlaceBlockage -boxList ${blkage_box} -name pr_place_blkage -type hard
    }
}

proc pr_t_del_IP_PlaceBlkage {} {
    deletePlaceBlockage pr_place_blkage
}

proc pr_t_add_pin_RouteBlkage {ori start end} {
    set topBox [lindex [dbget top.fPlan.box] 0]
    if { $ori == "left" } {
    	set box "[lindex $topBox 0] [expr $start-0.2] 1.8 [expr $end+0.2]"
	createRouteBlk -box ${box} -layer "M0 M1 M2 M3 M4 M5 M6 M7 M8 M9" -name PR_ROUTEBLK_pin
    } elseif { $ori == "right" } {
	set box "[expr [lindex $topBox 2]-1.8] [expr $start-0.2] [lindex $topBox 2] [expr $end+0.2]"
	createRouteBlk -box ${box} -layer "M0 M1 M2 M3 M4 M5 M6 M7 M8 M9" -name PR_ROUTEBLK_pin
    } elseif { $ori == "top" } {
	set box "[expr $start-0.2] [expr [lindex $topBox 3]-1.8] [expr $end+0.2] [lindex $topBox 3]"
	createRouteBlk -box ${box} -layer "M0 M1 M2 M3 M4 M5 M6 M7 M8 M9" -name PR_ROUTEBLK_pin
    } elseif { $ori == "bottom" } {
	set box "[expr $start-0.2] [lindex $topBox 1] [expr $end+0.2] [expr [lindex $topBox 1]+1.8]"
	createRouteBlk -box ${box} -layer "M0 M1 M2 M3 M4 M5 M6 M7 M8 M9" -name PR_ROUTEBLK_pin
    }
}

proc pr_t_del_pin_RouteBlkage {} {
    deleteRouteBlk -name PR_ROUTEBLK_pin
}
